package com.juhuixing.common.config.base;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.juhuixing.common.serializer.TimestampJsonSerializer;
import lombok.Data;
import java.io.Serializable;
import java.sql.Timestamp;

@Data
public class BaseEntity implements Serializable {

    /**
     * 主键
     */
    @JsonSerialize(using=ToStringSerializer.class)
    @TableId(value = "id",type = IdType.ID_WORKER)
    private Long id;

    @JsonIgnore
    @TableField("create_time")
    @JsonSerialize(using= TimestampJsonSerializer.class)
    private Timestamp createTime;

    @JsonIgnore
    @TableField("update_time")
    @JsonSerialize(using= TimestampJsonSerializer.class)
    private Timestamp updateTime;

    @JsonIgnore
    @TableField("create_user")
    private Long createUser;

    @JsonIgnore
    @TableField("update_user")
    private Long updateUser;

    public static final String ID = "id";

    public static final String CREATE_USER = "create_user";

    public static final String CREATE_TIME = "create_time";

    public static final String UPDATE_USER = "update_user";

    public static final String UPDATE_TIME = "update_time";
}
